<?php

/**
 * BolaoEvent filter form base class.
 *
 * @package    bolao-aabb
 * @subpackage filter
 * @author     Your name here
 */
abstract class BaseBolaoEventFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'creator_id'     => new sfWidgetFormPropelChoice(array('model' => 'sfGuardUserProfile', 'add_empty' => true)),
      'description'    => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'start_date'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'start_time'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'end_date'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'end_time'       => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'location'       => new sfWidgetFormFilterInput(array('with_empty' => false)),
      'category_id'    => new sfWidgetFormPropelChoice(array('model' => 'BolaoCategory', 'add_empty' => true)),
      'subcategory_id' => new sfWidgetFormPropelChoice(array('model' => 'BolaoSubcategory', 'add_empty' => true)),
      'created_at'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
      'updated_at'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate())),
    ));

    $this->setValidators(array(
      'creator_id'     => new sfValidatorPropelChoice(array('required' => false, 'model' => 'sfGuardUserProfile', 'column' => 'id')),
      'description'    => new sfValidatorPass(array('required' => false)),
      'start_date'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'start_time'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'end_date'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'end_time'       => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'location'       => new sfValidatorPass(array('required' => false)),
      'category_id'    => new sfValidatorPropelChoice(array('required' => false, 'model' => 'BolaoCategory', 'column' => 'id')),
      'subcategory_id' => new sfValidatorPropelChoice(array('required' => false, 'model' => 'BolaoSubcategory', 'column' => 'id')),
      'created_at'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'updated_at'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
    ));

    $this->widgetSchema->setNameFormat('bolao_event_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'BolaoEvent';
  }

  public function getFields()
  {
    return array(
      'id'             => 'Number',
      'creator_id'     => 'ForeignKey',
      'description'    => 'Text',
      'start_date'     => 'Date',
      'start_time'     => 'Date',
      'end_date'       => 'Date',
      'end_time'       => 'Date',
      'location'       => 'Text',
      'category_id'    => 'ForeignKey',
      'subcategory_id' => 'ForeignKey',
      'created_at'     => 'Date',
      'updated_at'     => 'Date',
    );
  }
}
